/* 
 * File:   SpeakerHandler.h
 * Author: Alex
 *
 * Created on 15 juni 2012, 13:08
 */

#ifndef SPEAKERHANDLER_H
#define	SPEAKERHANDLER_H
#include "pRTOS.h"
#include "Speaker.h"
#include "resources.h"

class SpeakerHandler  : public RTOS::task {
    
public:
     SpeakerHandler(): beeperDurTimer( this ), beeperFreqTimer( this ), speakerFlag( this ){}
     void beep(int Dur, int Freq);
private:
     SpeakerState state;
     RTOS::timer beeperDurTimer, beeperFreqTimer;
     RTOS::flag speakerFlag;
     struct speakerData{ int duration; int frequency; }; 
     RTOS::pool < struct speakerData > speakerPool;
     speakerData temp, current;
     int duration, frequency;
     bool speakerOn;
     Speaker spkr;
     void main(void);   
};
     

#endif	/* SPEAKERHANDLER_H */

